$(function() {
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.iframeAuto(index);

    $(".select-temp-product").on("click", function() {
        var id = $(this).data("id");
        if (parent.$("#tempId").val() != id) {
            var url = "/fmea/pfmea_product/step1_add/" + parent.$("#productId").val() + "?tempId=" + $(this).data("id");
            parent.window.location.href = url;
        } else {
            parent.layer.tips("已选择", "input[name='tempCode'][id='" + id + "']", {
                time : 3000
            });
        }
        parent.layer.close(index);
    });

    $(".select-temp-half").on("click", function() {
        var id = $(this).data("id");
        if (parent.$("#tempId").val() != id) {
            var url = "/fmea/pfmea_half/step1_add/" + parent.$("#halfId").val() + "?tempId=" + $(this).data("id");
            parent.window.location.href = url;
        } else {
            parent.layer.tips("已选择", "input[name='tempCode'][id='" + id + "']", {
                time : 3000
            });
        }
        parent.layer.close(index);
    });
});